﻿using Autofac;
using Commom;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace EF_Brave.Web
{
    public class BuildContainerRegister
    {
        public static IContainer BuildContainer()
        {
            var builder = new ContainerBuilder();
            #region DAL程序集注册
            var IDALAssembly = Assembly.Load("EF_Brave.Service");
            builder.RegisterAssemblyTypes(IDALAssembly).AsImplementedInterfaces();

            #endregion

            #region BLL程序集注册
            var ResourceDataAssembly = Assembly.Load("EF_Brave.Domain");
            builder.RegisterAssemblyTypes(ResourceDataAssembly).AsImplementedInterfaces();
            #endregion

            var container = builder.Build();
            DIContainer.RegisterContainer(container);
            return container;
        }
    }
}
